package com.ayuer.chapter10;

import java.util.List;
import java.util.Objects;

public class Vertex {

    String name;
    List<Edge> edges;
    boolean visited = false;
    int inDegree;
    int status;
    int distance = INF;
    static final int INF = Integer.MAX_VALUE;

    public Vertex(String name) {
        this.name = name;
    }

    @Override
    public String toString() {

        return "Vertex{" +
                "name='" + name + '\'' +
                ", distance=" + distance +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Vertex vertex = (Vertex) o;
        return Objects.equals(name, vertex.name);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(name);
    }
}
